//---------------------------------------------------------------------------

#ifndef h_serverH
#define h_serverH
//---------------------------------------------------------------------------

const int COMM_TIME_OUT = 60;

class HBatchIcon;

class HServer
{
public :
   static void __fastcall RefreshComplete(HBatchIcon *Batch);
   static void __fastcall LockRefresh(void);
   static void __fastcall UnlockRefresh(void);
   static bool __fastcall FuncChangeDate(HBatchIcon *Batch,
      const UTF8String &BatchDate, const UTF8String &NextBatchDate,
      const UTF8String &EndBatchDate, UTF8String &ErrorString);
   static bool __fastcall FuncStartBatch(HBatchIcon *Batch,
      const UTF8String &BatchDate, const UTF8String &NextBatchDate,
      const UTF8String &EndBatchDate, UTF8String &ErrorString);
   static bool __fastcall FuncPauseBatch(HBatchIcon *Batch,
      UTF8String &ErrorString);
   static bool __fastcall FuncContinueBatch(HBatchIcon *Batch,
      UTF8String &ErrorString);
   static bool __fastcall FuncStopBatch(HBatchIcon *Batch,
      UTF8String &ErrorString);
   static bool __fastcall FuncSkipJob(HBatchIcon *Batch,
      const UTF8String &Job, UTF8String &ErrorString);
   static bool __fastcall FuncRestoreJob(HBatchIcon *Batch,
      const UTF8String &Job, UTF8String &ErrorString);
   static bool __fastcall FuncRerunJob(HBatchIcon *Batch,
      const UTF8String &Job, UTF8String &ErrorString);
   static bool __fastcall FuncStopJob(HBatchIcon *Batch,
      const UTF8String &Job, UTF8String &ErrorString);
   static bool __fastcall FuncStopAndSkipJob(HBatchIcon *Batch,
      const UTF8String &Job, UTF8String &ErrorString);
   static void __fastcall FuncViewLog(HBatchIcon *Batch,
      const UTF8String &Job, bool RestoreFlag = false);
   static void __fastcall FuncViewAdditionalLog(HBatchIcon *Batch,
      const UTF8String &Job);
   static void __fastcall FuncCalcCriticalPath(HBatchIcon *Batch);
   static void __fastcall FuncViewSummary(HBatchIcon *Batch);
   static void __fastcall FuncDownload(HBatchIcon *Batch,
      const UTF8String &SrcFileName, const UTF8String &DesFileName);
   static bool __fastcall FuncLogin(HBatchIcon *Batch,
      const UTF8String &Id, const UTF8String &Password,
      const UTF8String &Auth, UTF8String &ErrorString);
   static void __fastcall FuncViewFailedJobList(HBatchIcon *Batch);
   static void __fastcall FuncViewTop20(HBatchIcon *Batch);
   static bool __fastcall FuncFireEvent(HBatchIcon *Batch,
      const UTF8String &EventName, UTF8String &ErrorString);
   static void __fastcall FuncOutline(HBatchIcon *Batch);
   static bool __fastcall FuncRestartJob(HBatchIcon *Batch,
      const UTF8String &Job, const UTF8String &BatchDate,
      const UTF8String &NextBatchDate, UTF8String &ErrorString);
   static bool __fastcall FuncChangeConfig(HBatchIcon *Batch,
      UTF8String &ErrorString);
   static bool __fastcall FuncChangeJobCondition(HBatchIcon *Batch,
      const UTF8String &JobName, bool CondNot, const UTF8String &ConditionFile,
      const UTF8String &SpecialDate, const UTF8String &LoopStartTime,
      const UTF8String &LoopEndTime, UTF8String &ErrorString);
   static bool __fastcall FuncBreakpoint(HBatchIcon *Batch,
      const UTF8String &Job, const UTF8String &SetUnset,
      UTF8String &ErrorString);

private :
   static bool __fastcall ReadFileFromSocket(SOCKET Sock,
      char *ErrorStr, const char *FileName);
   static bool __fastcall ReadFileFromSocketDecompress(SOCKET Sock,
      char *ErrorStr, const char *BinFileName, const char *XmlFileName,
      bool &RepeatFlag, HBatchIcon *Batch, bool &ProgressFlag, bool OldFlag);

   static bool RefreshLocked;
};

#endif
